{include file="common/head"}
<head>
<title>咨讯编辑</title>
<link    rel="stylesheet"    href="https://cdnjs.cloudflare.com/ajax/libs/jodit/3.24.2/jodit.es2018.min.css"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jodit/3.24.2/jodit.es2018.min.js"></script>    

<style>
  .box{border: 0px solid #ccc;text-align: left;max-width: 800px;padding:10px 20px;}
</style>
</head>
<body style="">
    <div class="box" id="editer"    >
    <h2>咨讯编辑</h2>
    <form method="post" action="/index.php/index/news_edit" enctype="multipart/form-data">
      <input type="hidden" name="id" value="{$data.id}" />
      <input type="hidden" name="post_edit" value="1" />

      <div class="mb-3">
        <img src="{$data.image}" style="width: 200px;border:1px solid #ccc;"/>
        <label for="file" class="form-label">咨讯图片:</label>
        <input type="file"  name="file" /> <br> 
      </div>

      <div class="mb-3 mt-3">
        <lable for="name2" class="form-label">资讯标题:</label>
        <input type="text" class="form-control" id="title" name="title" value="{$data.title}" placeholder="标题" />
      </div>

      <div class="mb-3">
        <label for="title" class="form-label">内容（提示：网络图片可以大大减少服务器空间占用，非常不建议粘贴本地图片）</label>
        <textarea class="form-control" id="content" name="content" placeholder="内容" >{$data.content}</textarea>
      </div>
 
      <div class="mb-3">
        <label for="status" class="form-label">是否启用(Using):</label>
          <input type="radio" class="form-check-input" id="radio1" name="status" value="1" {if $data.status==1} checked {/if}/> 
          <label class="form-check-label" for="radio1">启用(Using)</label>
          <input type="radio" class="form-check-input" id="radio2" name="status" value="2" {if $data.status==2} checked {/if}/>
          <label class="form-check-label" for="radio2">停用(Stoped)</label>
       </div>
      <button  type="button" class="btn btn-primary" onclick="doSave()">保存</button>

    </form>
    </div>


<script type="text/javascript">

    var editor = Jodit.make('#content',{
      toolbarButtonSize: 'small',
      //textIcons: true
    });
    //editor.value = ''; 

    function doSave(){
      if(!$("#title").val() || !$("#content").val()) {
        layer.msg("无效的资讯名称,内容!");
        return 0;
      }    
      $('form').submit();
    }

</script>


</body>
</html>
